<template>
  <div v-if="support">
    <el-avatar :size="35"
               :src="data.user.image"></el-avatar>
    <label for="">{{data.user.account}}</label>
    <br>
    <img :src="data.recent.image"
         alt=""
         style="width:200px">
    <p>{{data.recent.content}}</p>
    <label>{{data.recent.time}}</label>
    <div align="right">
      <el-badge class="item">
        <i class="el-icon-thumb">点赞</i>
      </el-badge>
      <i class="el-icon-chat-line-round">
        <span @click="findRecentDetail(data.recent.id)">评论</span>
      </i>
    </div>
  </div>

</template>
<script>
import http from '../../../../axios_config';
export default {
  props: {
    detail: {},
  },
  data () {
    return {
      data: {},
      support: false,
      aggree: []
    }
  },
  methods: {
    //查看评论
    comment (commentList) {
      this.$emit("showComment", { data: commentList })
    },
    //查询评论
    findRecentDetail (rid) {
      http.get("http://192.168.11.18:8080/recentcomment/findComments?id=" + rid)
        .then(res => {
          this.aggree = res.data.data;
          this.$emit("showcomment", { result: true, data: this.aggree });
        });

    },
  },
  mounted () {
    this.data = this.detail;
    console.log(this.data.recent.image);
    this.support = true;
  }

}
</script>

<style scoped>
</style>